import 'package:banyou_app/app/modules/dongtai/views/dongtai_view.dart';
import 'package:banyou_app/app/modules/home/views/home_view.dart';
import 'package:banyou_app/app/modules/mine/views/mine_view.dart';
import 'package:banyou_app/app/modules/xiangqu/views/xiangqu_view.dart';
import 'package:banyou_app/app/widget/bottom_bar.dart';
import 'package:banyou_app/app/widget/keep_alive_page.dart';
import 'package:flutter/material.dart';

import 'package:get/get.dart';

import '../controllers/tabbat_controller.dart';

class TabbarView extends GetView<TabbatController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          Positioned.fill(
              child: PageView(
            physics: const NeverScrollableScrollPhysics(),
            // onPageChanged: controller.changePage,
            controller: controller.pageController,
            children: [
              keepAliveWrapper(HomeView()),
              keepAliveWrapper(XiangquView()),
              keepAliveWrapper(DongtaiView()),
              keepAliveWrapper(MineView()),
            ],
          ))
        ],
      ),
      bottomNavigationBar: Obx(() => controller.showTabbar.value
          ? BottomAppBar(
              child: Obx(() => HomeBottomBar(
                  controller.currentIndex.value, controller.changePage)))
          : Container(
              height: 1,
            )),
    );
  }
}
